package com.hawthorn.admin.repository;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hawthorn.admin.repository.provider.SysRoleSqlProvider;
import com.hawthorn.entity.po.SysRolePO;
import com.hawthorn.platform.repository.DBMapper;
import org.apache.ibatis.annotations.SelectProvider;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * <p>todo 系统角色Mapper类</p>
 * @author: andy.ten@tom.com | xukaixing@hotmail.com
 * @created: 2022/7/29 10:25
 * @version v1.0.1
 * @copyright: Copyright (c)  andyten
 */
@Repository
public interface SysRoleMapper extends DBMapper<SysRolePO>
{

  @SelectProvider(SysRoleSqlProvider.class)
  IPage<Map<String, Object>> findRoles(Page<Map<String, Object>> page, String conditions);

  @SelectProvider(SysRoleSqlProvider.class)
  IPage<Map<String, Object>> findDealerRoles(Page<Map<String, Object>> page, String conditions);

  @SelectProvider(SysRoleSqlProvider.class)
  Integer findRoleByCode(String rcode);

  @SelectProvider(SysRoleSqlProvider.class)
  Integer findDealerRoleByCode(String rcode, Long deptId);

  @SelectProvider(SysRoleSqlProvider.class)
  List<Map<String, Object>> findUserByRoleId(Long roleId);
}
